<?php
    require_once("condb.php");
    require_once("functions.php");
    
    $output = array();
    $info = isset($_GET["info"]) ? $_GET["info"] : "";
    if(!empty($info)){
        $info = urldecode(base64_decode($info));
        parse_str($info, $request);    
        
        $token = isset($request["token"]) ? cleanQuery($request["token"]) : "";
        if($token=="TAoViEC@)!#2012"){
            
            $data = array();
            $data["sms_content"] = isset($request["sms_content"]) ? cleanQuery($request["sms_content"]) : "";            
            
            if(!empty($data["sms_content"])){
                
                $checkSms = checkSmsLog($data["sms_content"]);
                if($checkSms==0){
                    
                    /* chưa kích hoạt */
                    $output["status"] = 1;                    
                    $output["msg"] = "Chua gui duoc tin nhan";                    
                    
                } else {
                    
                    /* chưa kích hoạt */
                    $output["status"] = 0;                    
                    $output["msg"] = "Da gui tin nhan thanh cong";                    
                    
                }    
            } else {
                $output["status"] = 4;
                $output["msg"] = "Invalid Request";    
            }
            
            
        } else {
            $output["status"] = 3;
            $output["msg"] = "Invalid Request";    
        }
    } else {
        $output["status"] = 2;
        $output["msg"] = "Invalid Request";
    }

    echo json_encode($output);  
?>